<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div {
      width: 300px;
      height: 300px;
    }

    .red {
      position: relative;
      top: 0;
      left: 0;
      background-color: red;
    }

    .green {
      position: absolute;
      top: 100px;
      left: 100px;
      background-color: green;
    }

    .blue {
      position: fixed;
      top: 200px;
      left: 200px;
      background-color: blue;
    }
  </style>
</head>
<body>
  <!-- 不同布局方式元素的层级关系 -->
  <!-- 标准流 < 浮动 < 定位 -->
  <!-- 不同定位之间的层级关系 -->
  <!-- 相对、绝对、固定，默认层级相同 -->
  <!-- 此时HTML中写在下面的元素层级更高，会覆盖上面的元素 -->
  <div class="red"></div>
  <div class="green"></div>
  <div class="blue"></div>
</body>
</html>